<%@ tag language="java" pageEncoding="utf-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib tagdir="/WEB-INF/tags" prefix="tags" %>
<%@ attribute name="value" type="java.lang.Object" required="true" rtexprvalue="true" %>
<c:set var="review" value="${value}" />
<div class="rcontents">
  <h1><c:out value="${review.hospitalReview.title}" /></h1>
  <c:set var="average" value="${review.hospitalReviewScore.score}" />
  <c:if test="${average < 0.1}"><c:set var="SCORE_CSS_DEFNAME" value="p00" /></c:if>
  <c:if test="${average >= 0.1 && 1.0 > average}"><c:set var="SCORE_CSS_DEFNAME" value="p05" /></c:if>
  <c:if test="${average >= 1.0 && 1.4 > average}"><c:set var="SCORE_CSS_DEFNAME" value="p10" /></c:if>
  <c:if test="${average >= 1.4 && 2.0 > average}"><c:set var="SCORE_CSS_DEFNAME" value="p15" /></c:if>
  <c:if test="${average >= 2.0 && 2.4 > average}"><c:set var="SCORE_CSS_DEFNAME" value="p20" /></c:if>
  <c:if test="${average >= 2.4 && 3.0 > average}"><c:set var="SCORE_CSS_DEFNAME" value="p25" /></c:if>
  <c:if test="${average >= 3.0 && 3.4 > average}"><c:set var="SCORE_CSS_DEFNAME" value="p30" /></c:if>
  <c:if test="${average >= 3.4 && 4.0 > average}"><c:set var="SCORE_CSS_DEFNAME" value="p35" /></c:if>
  <c:if test="${average >= 4.0 && 4.4 > average}"><c:set var="SCORE_CSS_DEFNAME" value="p40" /></c:if>
  <c:if test="${average >= 4.4 && 5.0 > average}"><c:set var="SCORE_CSS_DEFNAME" value="p45" /></c:if>
  <c:if test="${average >= 5.0}"><c:set var="SCORE_CSS_DEFNAME" value="p50" /></c:if>
  <div class="rating">
    <p class="datetime">投稿日時&nbsp;&nbsp;<fmt:formatDate value="${review.hospitalReview.createDateTime}" pattern="yyyy年MM月dd日 HH:mm" /></p>
    <p>総合評価：<span class="${SCORE_CSS_DEFNAME}" style="padding: 6px 0 1px 95px;"><em class="score"><fmt:formatNumber value="${average}" maxFractionDigits="2" minFractionDigits="2" /></em></span></p>
  </div>
  <pre><c:out value="${review.hospitalReview.content}" /></pre>
  <div class="postedby">
    <span class="author"><a href='<c:url value="/users/${review.createUser.id}.html" />'><c:out value="${review.createUser.username}" /></a>&nbsp;（<c:if test="${empty review.createUser.sex}">非公開</c:if><c:if test="${not empty review.createUser.sex}"><tags:sex value="${review.createUser.sex}" /></c:if>）</span>
  </div>
</div>
